import request from "@/utils/request";
import { BannerListType } from '@/views/Home/components/Banner/type.ts'
import qs from 'qs'

// 使用枚举包含所有的 path
enum Api {
  // 获取 banner 数据
  getBanner = '/banner',
  // 获取精品歌单数据
  getPlayListData = '/top/playlist/highquality',
  // 获取歌单所有歌曲
  getPlaySongListData = '/playlist/track/all',
  // 获取歌曲Url
  getSongUrl = '/song/url/v1',
  // 获取歌曲详情数据
  getSongDetailData = '/song/detail'
}


// 获取 banner 信息的Api
export const getBannerApi = () => {
  return request.get(Api.getBanner)
}

// 获取精品歌单数据的Api
export const getPlayListApi = (data: { limit: number, before?: string }) => {
  let dataQ = '?' + qs.stringify(data)
  return request.get(Api.getPlayListData + dataQ)
}

// 获取歌单所有歌曲的Api
export const getPlaySongListDataApi = (data: { id: number, limit: number, offset: number }) => {
  let dataQ = '?' + qs.stringify(data)
  return request.get(Api.getPlaySongListData + dataQ)
}

// 获取歌曲Url的Api
export const getSongUrlApi = (data: { id: number, level: string }) => {
  let dataQ = '?' + qs.stringify(data)
  return request.get(Api.getSongUrl + dataQ)
}

// 获取歌曲详情数据的Api
export const getSongDetailDataApi = (data: { ids: number }) => {
  let dataQ = '?' + qs.stringify(data)
  return request.get(Api.getSongDetailData + dataQ)
}